package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.UserRule;
import com.ruoyi.system.mapper.UserRuleMapper;
import com.ruoyi.system.service.IUserRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 考勤规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-20
 */
@Service
public class UserRuleServiceImpl implements IUserRuleService 
{
    @Autowired
    private UserRuleMapper userRuleMapper;

    /**
     * 查询考勤规则
     * 
     * @param id 考勤规则主键
     * @return 考勤规则
     */
    @Override
    public UserRule selectUserRuleById(Long id)
    {
        return userRuleMapper.selectUserRuleById(id);
    }

    /**
     * 查询考勤规则列表
     * 
     * @param userRule 考勤规则
     * @return 考勤规则
     */
    @Override
    public List<UserRule> selectUserRuleList(UserRule userRule)
    {
        return userRuleMapper.selectUserRuleList(userRule);
    }

    /**
     * 新增考勤规则
     * 
     * @param userRule 考勤规则
     * @return 结果
     */
    @Override
    public int insertUserRule(UserRule userRule)
    {
        userRule.setCreateTime(DateUtils.getNowDate());
        return userRuleMapper.insertUserRule(userRule);
    }

    /**
     * 修改考勤规则
     * 
     * @param userRule 考勤规则
     * @return 结果
     */
    @Override
    public int updateUserRule(UserRule userRule)
    {
        userRule.setUpdateTime(DateUtils.getNowDate());
        return userRuleMapper.updateUserRule(userRule);
    }

    /**
     * 批量删除考勤规则
     * 
     * @param ids 需要删除的考勤规则主键
     * @return 结果
     */
    @Override
    public int deleteUserRuleByIds(Long[] ids)
    {
        return userRuleMapper.deleteUserRuleByIds(ids);
    }

    /**
     * 删除考勤规则信息
     * 
     * @param id 考勤规则主键
     * @return 结果
     */
    @Override
    public int deleteUserRuleById(Long id)
    {
        return userRuleMapper.deleteUserRuleById(id);
    }



}
